package com.blog.attach.handler;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * @author admin
 * @version 1.0 <br/>
 * <p style="font-family:SimSun;font-weight:bold">时间:<br/>2021/12/10 13:21</p>
 */

@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
    @Override
    public void insertFill(MetaObject metaObject) {
        this.setFieldValByName("commentTime",new Date(),metaObject);
        this.setFieldValByName("replayTime",new Date(),metaObject);
        this.setFieldValByName("replayCount",0,metaObject);
    }
    @Override
    public void updateFill(MetaObject metaObject) {
          }
}
